package io.lkt.modules.sys.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;

import io.lkt.modules.sys.dao.BUserCommodityInfoDao;
import io.lkt.modules.sys.entity.BUserCommodityInfoEntity;
import io.lkt.modules.sys.service.BUserCommodityInfoService;


@Service("bUserCommodityInfoService")
public class BUserCommodityInfoServiceImpl extends ServiceImpl<BUserCommodityInfoDao, BUserCommodityInfoEntity> implements BUserCommodityInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String commodityName=params.get("commodityName").toString();
        String userId=params.get("userId").toString();
        IPage<BUserCommodityInfoEntity> page = this.page(
                new Query<BUserCommodityInfoEntity>().getPage(params),
                new QueryWrapper<BUserCommodityInfoEntity>().like(StringUtils.isNotBlank(commodityName),"commodity_name", commodityName).
                        eq(StringUtils.isNotBlank(userId),"user_id", userId).orderByDesc("id")
        );

        return new PageUtils(page);
    }

}
